<template>
  <div>
  <div class="log">
    personal
  </div>
    <div>
      <el-col :span="12" class="nav">
        <el-menu
          default-active="this.$route.path"
          router mode="horizontal"
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
          background-color="lightskyblue"
          text-color="black"
          border-bottom="px"
          active-text-color="black">
          <el-submenu index="1" >
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>仪表盘</span>
            </template>
              <el-menu-item-group>
              </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2" >
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>博客</span>
            </template>

            <el-menu-item-group class="menu">

              <el-menu-item v-for="(item, i) in ArtList" :key="i" :index="'/admin' + item.path">
                {{item.name}}
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="3">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>分类列表</span>
            </template>
            <el-menu-item-group class="menu">
              <el-menu-item v-for="(item, i) in CategoryList" :key="i" :index="'/admin' + item.path">
                {{item.name}}
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="4">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>用户管理</span>
            </template>
            <el-menu-item-group class="menu">
              <el-menu-item  v-for="(item, i) in UserList" :key="i" :index="'/admin' + item.path" >
                {{item.name}}
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-col>
    </div>

  </div>
</template>

<script>
export default {
  name: "Nav",
  data(){
    return{
      ArtList:[
        {name: '修改文章',path:'/addArt'},
        {name: '文章列表',path: '/artList'},
      ],
      CategoryList:[
        {path: '/categoryList', name: 'category列表'},
      ],
      UserList:[
        {path: '/UserList', name: '用户管理'},
      ]
    }
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    }
  }
}
</script>

<style>
.el-menu--horizontal>.el-submenu.is-active .el-submenu__title{
  border-bottom:0px;
}
</style>




<style scoped>

.el-menu-vertical-demo :hover{
  background: lightskyblue!important;
  color: black!important;
}
.el-menu-item:hover{
  background:lightskyblue!important;
  color: black!important;
}
.el-submenu:hover {
  background: lightskyblue!important;
  color: black!important;
}
.nav {
  margin-top: 30px;
  margin-left: 15px;
  width: 160px;
  overflow-x: auto

}

.el-menu{
  border-bottom: 0px;
}
.log{
  height: 30px;
  width: 150px;
  background-color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-left: 10px;
  margin-top: 10px;
}
</style>

